<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>平台交易统计</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../lib/layui-v2.6.3/css/layui.css" media="all">
    <link rel="stylesheet" href="../css/public.css" media="all">
</head>
<body>
<div class="layuimini-container">
    <div class="layuimini-main">

        <table class="layui-hide" id="userAndOrder" lay-filter="currentTableFilter"></table>

        <fieldset class="table-search-fieldset">
            <legend>按照日期搜索</legend>
            <div style="margin: 10px 10px 10px 10px">
                <form class="layui-form layui-form-pane" action="">
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">日期</label>
                            <div class="layui-inline">
                                <input type="text" class="layui-input" id="test1">
                            </div>
                        </div>

                        <div class="layui-inline">
                            <button type="submit" class="layui-btn layui-btn-primary" id="shousuobtn" lay-submit
                                    lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索
                            </button>
                        </div>
                    </div>
                </form>
            </div>
        </fieldset>
        <table class="layui-hide" id="horsemanPackageOrder" lay-filter="currentTableFilter"></table>

        <script type="text/html" id="currentTableBar">
            <!--<a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="edit">编辑</a>-->
            <!--<a class="layui-btn layui-btn-xs layui-btn-danger data-count-delete" lay-event="delete">删除</a>-->
        </script>

    </div>
</div>
<script src="../lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
<script>
    layui.use(['form', 'table'], function () {
        var $ = layui.jquery,
            form = layui.form,
            table = layui.table;

        table.render({
            elem: '#userAndOrder',
            url: '/dhn/adminRelevant/getYesterdayAddUserAndOrder',
            parseData: function (res) { //res 即为原始返回的数据
                return {
                    "code": res.code, //解析接口状态
                    "msg": res.result, //解析提示文本
                    "data": res.content //解析数据列表
                }
            },
            toolbar: '#toolbarDemo',
            defaultToolbar: ['filter', 'exports', 'print', {
                title: '提示',
                layEvent: 'LAYTABLE_TIPS',
                icon: 'layui-icon-tips'
            }],
            cols: [[
                {field: 'statisticsTime', title: '日期.'},
                {field: 'addUser', title: '新增用户数'},
                {field: 'allUser', title: '累积用户数'},
                {field: 'id', title: '其他渠道新增用户'},
                {field: 'orderCount', title: '订单量'},
                {field: 'completedOrder', title: '已完成'},
                {field: 'incompleteOrder', title: '未完成'},
                {field: 'waste', title: '异常订单'},
                {field: 'plastic', title: '塑料类回收重量'},
                {field: 'plasticMoney', title: '塑料类回收金额'},
                {field: 'paper', title: '废纸类回收重量'},
                {field: 'paperMoney', title: '废纸类回收金额'},
                {field: 'textiles', title: '纺织物回收重量'},
                {field: 'textilesMoney', title: '纺织物回收金额'},
                {field: 'metal', title: '金属类回收重量'},
                {field: 'metalMoney', title: '金属类回收金额'},
                {field: 'electrical', title: '家电类回收台数'},
                {field: 'electricalMoney', title: '家电类回收金额'},
                {field: 'allWeight', title: '回收总重量'},
                {field: 'allMoney', title: '回收总金额'}
            ]],
            skin: 'line'
        });

        table.render({
            elem: '#horsemanPackageOrder',
            url: '/dhn/adminRelevant/recyclingStatistics',
            toolbar: '#toolbarDemo',
            defaultToolbar: ['filter', 'exports', 'print', {
                title: '提示',
                layEvent: 'LAYTABLE_TIPS',
                icon: 'layui-icon-tips'
            }],
            cols: [[
                {field: 'statisticsTime', title: '日期.'},
                {field: 'horsemanName', title: '骑手名字'},
                {field: 'addUser', title: '今日推广用户数'},
                {field: 'allUser', title: '累计推广用户数'},
                {field: 'orderCount', title: '当天订单量'},
                {field: 'completedOrder', title: '已完成'},
                {field: 'incompletedOrder', title: '未完成'},
                {field: 'plastic', title: '塑料类回收重量'},
                {field: 'plasticMoney', title: '塑料类回收金额'},
                {field: 'paper', title: '废纸类回收重量'},
                {field: 'paperMoney', title: '废纸类回收金额'},
                {field: 'textiles', title: '纺织物回收重量'},
                {field: 'textilesMoney', title: '纺织物回收金额'},
                {field: 'metal', title: '金属类回收重量'},
                {field: 'metalMoney', title: '金属类回收金额'},
                {field: 'electrical', title: '家电类回收台数'},
                {field: 'electricalMoney', title: '家电类回收金额'},
                {field: 'waste', title: '大件废弃物回收件数'},
                {field: 'wasteMoney', title: '大件废弃物回收金额'},
                {field: 'allWeight', title: '当天回收总重量'},
                {field: 'allMoney', title: '当天回收总金额'}
            ]],
            limits: [10, 15, 20, 25, 50, 100],
            limit: 10,
            page: true,
            skin: 'line'
        });
        // 监听搜索操作
        form.on('submit(data-search-btn)', function (data) {
            var date = $("#test1").val();
            //执行搜索重载
            table.reload('horsemanPackageOrder', {
                page: {
                    curr: 1
                }, where: {
                    date: date
                }
            }, 'data');
            return false;
        });
    });

    layui.use('laydate', function () {
        var laydate = layui.laydate;

        //执行一个laydate实例
        laydate.render({
            elem: '#test1' //指定元素
        });
    });
</script>

</body>
</html>